package com.hnevc.mytrafficdemo.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.hnevc.mytrafficdemo.R;

public class AntiTrafficActivity extends AppCompatActivity {

    Button mBtnQuery ;
    EditText mEtCarNum;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_anti_traffic);

        mBtnQuery = (Button) findViewById(R.id.id_btn_query);
        mEtCarNum = (EditText) findViewById(R.id.id_et_bus_num);

        mBtnQuery.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(getIntent().getIntExtra("flag",1)==1) {
                    String carnum = "鲁" + mEtCarNum.getText().toString();
                    Intent intent = new Intent();
                    intent.putExtra("carnum", carnum);
                    intent.setClass(AntiTrafficActivity.this, AntiTrafficDetailActivity.class);
                    startActivity(intent);
                }else{
                    String carnum = "鲁" + mEtCarNum.getText().toString();
                    Intent intent = new Intent();
                    intent.putExtra("carnum", carnum);
                    setResult(101,intent);
                }
            }
        });
    }
}
